package cn.edu.scujcc.myproject.ui.home;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import cn.edu.scujcc.myproject.R;

public class ChannelRvAdapter extends RecyclerView.Adapter<ChannelRvAdapter.ChannelRowHolder> {

    /**
     * 当需要新的一行时，此方法负责
     * @param parent
     * @param viewType
     * @return
     */
    @NonNull
    @Override
    public ChannelRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View rowView= LayoutInflater.from(parent.getContext()).inflate(R.layout.channel_row,parent,false);
        ChannelRowHolder holder=new ChannelRowHolder(rowView);
        return null;
    }

    @Override
    public int getItemCount() {
        //此处暂时硬编码为10行
        return 10;
    }



    @Override
    public void onBindViewHolder(@NonNull ChannelRowHolder holder, int position) {
        holder.bind("诺洪则");
    }

    public class ChannelRowHolder extends RecyclerView.ViewHolder{
        private TextView title;
        public ChannelRowHolder(@NonNull View row){
            super(row);
            this.title=row.findViewById(R.id.channel_title);
//            this.title=row.findViewById(R.id.imageView2);
        }
        public void bind(String titile){
            this.title.setText(titile);
        }
    }
}
